<template>
  <div>
      <h3>帐户汇总</h3>
      <table class="table table-bordered">
        <tr>
          <td>登录名称</td>
          <td>
            {{ store.userInfo.userName }}
          </td>
        </tr>
        <tr>
          <td>借款金额</td>
          <td>
            {{  UBMoeny.UBMoney }}
          </td>
        </tr>
        <tr>
          <td>还款金额</td>
          <td>
            {{ UBRMoney.UBRMoney }}
          </td>
        </tr>
      </table>
  </div>
</template>

<script setup lang="ts">
import {reactive,toRefs,onMounted} from 'vue'
import {useRouter,useRoute} from 'vue-router'
import axios from 'axios';
const router = useRouter();
const route = useRoute();

import { useStore } from '../store/use';
const store = useStore();


let data:any = reactive({
  UBMoeny:'',
  UBRMoney:''
})

let {UBRMoney,UBMoeny} = toRefs(data)

onMounted(()=>{
  getList1()
  getList2()
})

const getList1 = ()=>{
  axios({
    url:'/api/Users/GetCount',
    method:'',
    params:{
      userId:store.userInfo.userId
    }
  })
  .then(res=>{
    console.log(res);
    UBMoeny.value = res.data.data[0]
  })
  .catch(err=>{
    console.log(err);
    
  })
}

const getList2 = ()=>{
  axios({
    url:'/api/Users/GetCount2',
    method:'',
    params:{
      userId:store.userInfo.userId
    }
  })
  .then(res=>{
    console.log(res);
    UBRMoney.value = res.data.data[0]
    
  })
  .catch(err=>{
    console.log(err);
    
  })
}
</script>

<style scoped>

</style>